/**
 * ClassName test
 * Description TODO
 * Author Yanyan
 * Date 2025/11/4 20:16
 * Version 1.0
 */
public class test {
    public static void main6(String[] args) {
        for (int i = 0; i < 999999; i++) {
            int count = 0;//记录有多少位
            int temp = i;//临时储存数据，防止它被改变
            while(temp != 0){
                count++;
                temp /= 10;
            }
            int sum = 0;//储存各位数的和
            temp = i;
            for (int j = 0; j < count; j++) {
                sum += Math.pow(temp % 10, count);
                temp /= 10;
            }
            if(sum == i) {
                System.out.print(i+" ");
            }
        }
    }

    //求一个整数，在内存当中存储时，二进制1的个数。
    public static void main5(String[] args) {
        int num = 24;
        int count = 0;
        int i = num;
        while(i > 0)
        {
            i &= i-1;
            count++;
        }
        System.out.println(num+"存储的二进制中1的个数为"+count);
    }


    //输出 1000 - 2000 之间所有的闰年
    public static void main4(String[] args) {
        int year = 1000;
        for(; year <= 2000; year++){
            if(((year % 4 == 0)&&(year % 100 != 0)) || (year % 400 == 0)) {
                System.out.print(year+" ");
            }
        }
    }

    public static void main3(String[] args) {
        int sum = 0;
        for (int i = 0; i < 10; i++) {
            sum += i;//fori快捷键
        }
        System.out.println(sum);//变量.sout
    }

    public static void main2(String[] args) {
        int num = 1;
        while (num <= 100) {
            if (num % 12 != 0) {
                num++;
                continue;
            }
            System.out.print(num + " ");
            num++;
        }
    }

    public static void main1(String[] args) {
        int num = 1;
        for (; num < 101; num++) {
            if (num % 3 == 0 && num % 4 == 0) {
                System.out.print(num + " ");
            }
        }
    }
}
